<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" isELIgnored="false" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<!DOCTYPE html>
<html>
<head>
    <jsp:include page="/WEB-INF/jsp/include/head.jsp"/>
</head>
<body>
<ol class="breadcrumb">
    <li><strong>当前位置： </strong>标准化管理</li>
    <li><a href="expertInfo/adminEdit/index">专家管理</a></li>
    <li class="active">导入专家</li>
</ol>


<div class="panel panel-info">
    <div class="panel-heading">
        <h3 class="panel-title selectslid" style="display: inline-block">导入</h3>
        <a role="button" style="float: right;" class="btn btn-default btn-xs btn-success"
           href="downloadFileByPath?pathName=excelTemplate/expertInfoTemplate.rar&newName=Excel导入专家模板.rar"><span class="glyphicon glyphicon-save"></span>&nbsp;Excel模板下载&nbsp</a>

    </div>
    <div class="panel-body">
        <form id="form_data" class="form-horizontal row" method="post" enctype="multipart/form-data"
              action="expertInfo/adminEdit/uploadExpertInfo/insert">
            <div class="form-group col-sm-4 ">
                <label class="col-sm-4 control-label">信息类型：</label>
                <div class="col-sm-7">
                    <select class="form-control" id="tableName" name="tableName">
                        <option value="">&nbsp;</option>
                        <option value="EMS_EXPERT_BASE">1、基本信息</option>
                        <option value="EMS_EXPERT_COMPANY">2、工作单位</option>
                        <option value="EMS_EXPERT_CERTIFICATE">3、资质证书</option>
                        <option value="EMS_EXPERT_EDUCATION">4、教育经历</option>
                        <option value="EMS_EXPERT_REVIEW">5、审查/评审经历</option>
                        <option value="EMS_EXPERT_TRAIN">6、培训经历</option>
                        <option value="EMS_EXPERT_WORK">7、工作经历</option>
                    </select>
                </div>
            </div>

            <div class="form-group col-sm-4 ">
                <label class="control-label col-sm-4 ">文　　件：</label>
                <div class="col-sm-7">
                    <input type="file" class="form-control" name="file">
                </div>
            </div>


            <div class="form-group col-sm-4">
                <div class="col-sm-7 col-sm-offset-1">
                    <button id="btn_search" type="submit" class="btn btn-default btn-success  btn-sm"><span
                            class="glyphicon glyphicon-ok"></span>&nbsp;导 入&nbsp;</button>
                </div>
            </div>
            <div class="col-sm-12 col-sm-offset-4">
                 <p style="color: red">${errorMessage}</p>
            </div>
        </form>
    </div>
</div>

<c:if test="${isSuccess}">
    <p style="text-align: center ;color: green ;font-size: large;font-weight: bold ;margin-top: 100px"> 导入成功！共录入${rowCount}条数据。 </p>
</c:if>

<table   class="table table-hover table-striped table-bordered" >
    <c:if test="${errorData!=null}">
        <tr>
            <c:forEach items="${columnTitle}" var="i" varStatus="status" >
                    <th>${i}</th>
            </c:forEach>
        </tr>

        <c:forEach items="${errorData}" var="i">
            <tr>
                <c:forEach items="${i}" var="j" varStatus="status">

                    <c:if test="${status.index< fn:length(columnTitle)}">
                        <td>${j}</td>
                    </c:if>
                </c:forEach>
            </tr>
        </c:forEach>
    </c:if>
</table>


<jsp:include page="/WEB-INF/jsp/include/footer.jsp"/>
<script>
    $.sysPlugin.initSelect2($("#tableName"),{
        value:'${tableName}'

    })


    <%--bootstrapValidator--%>
    $form_data=$("#form_data");
    $form_data.bootstrapValidator({
        feedbackIcons: {
            valid: 'glyphicon glyphicon-ok',
            invalid: 'glyphicon glyphicon-remove',
            validating: 'glyphicon glyphicon-refresh'
        },
        fields: {

            tableName: {
                validators: {
                    notEmpty: {
                        message: '不能为空！'
                    }
                }
            }, file: {
                validators: {
                    notEmpty: {
                        message: '不能为空！'
                    }
                }
            }
        }
    }).on('success.form.bv', function (e) {
//        e.preventDefault();


    });


</script>

</body>
</html>
